#============================================================
#	Attack Helper
#============================================================
# @datetime: 2022-5-11 19:23:16
#============================================================
class_name AttackHelper


const WEAPON_TYPE_KEY = "weapon"


##  攻击目标
## @attacker  攻击者
## @target  攻击目标
static func attack_to(attacker: Node, target: Node):
	# 获取受伤者的 Damage
	var damage_wrapper : DamageWrapper = WrapperHelper.get_damage(target)
	if damage_wrapper:
		# 获取攻击者的装备的第一个物品数据
		var data = WrapperHelper \
			.get_equipment(attacker) \
			.get_type_first_item(WEAPON_TYPE_KEY)
		if data:
			damage_wrapper.to_damage(target, {
				"damage": data.damage
			})
		else:
			Logger.error(attacker, ["AttackHelper：出现错误，没有装备这类型的物品"])
